package com.applancer.notification;

import java.util.concurrent.atomic.AtomicInteger;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;

import com.applancer.nativecmsflip.MainActivity;
import com.google.android.gms.gcm.GoogleCloudMessaging;

public class GcmData {

	public final static int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
	public static final String EXTRA_MESSAGE = "message";
	public static final String PROPERTY_REG_ID = "registration_id";
	public static final String PROPERTY_APP_VERSION = "appVersion";

	//public static String SENDER_ID = "624722398240";
	public static String SENDER_ID = "409122136060";
	public static final String TAG = "GCMDemo";

	public static GoogleCloudMessaging gcm;
	public static AtomicInteger msgId = new AtomicInteger();
	public static SharedPreferences prefs;

	public static String regid;

	public static Activity act;

	public static SharedPreferences getGCMPreferences(Context context) {
		// This sample app persists the registration ID in shared preferences,
		// but
		// how you store the regID in your app is up to you.
		return context.getSharedPreferences(MainActivity.class.getSimpleName(),
				Context.MODE_PRIVATE);
	}

	public static int getAppVersion(Context context) {
		try {
			PackageInfo packageInfo = context.getPackageManager()
					.getPackageInfo(context.getPackageName(), 0);
			return packageInfo.versionCode;
		} catch (NameNotFoundException e) {
			// should never happen
			throw new RuntimeException("Could not get package name: " + e);
		}
	}

}
